home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 February / PCWFEB08.iso / Software / Freeware / Miro 1.0 / Miro_Installer.exe / Miro_Downloader.exe / compiled_templates / channel_content.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2007-11-12  |  24.2 KB  |  369 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.5)
  3.  
  4. from template import Handle, fillAttr, quoteAndFillAttr, fillStaticTemplate
  5. from StringIO import StringIO
  6. from xhtmltools import urlencode
  7. from templatehelper import quoteattr, escape
  8. from string import Template
  9. import app
  10. import views
  11. import sorts
  12. import indexes
  13. import filters
  14. import resources
  15. import gtcache
  16. _ = gtcache.gettext
  17.  
  18. def fillTemplate(domHandler, dtvPlatform, eventCookie, bodyTagExtra, *args, **kargs):
  19.     localvars = locals()
  20.     localvars.update(globals())
  21.     handle = Handle(domHandler, localvars, onUnlink = (lambda : None))
  22.     
  23.     def up_0_handle(viewName, view, tid):
  24.         out = StringIO()
  25.         out.write(u'<div id="')
  26.         out.write(quoteattr(tid))
  27.         out.write(u'">\n')
  28.         if not allDownloadingItems.len() == 0:
  29.             out.write(u'<div>\n<div class="main-channelbar downloading-channelbar" onclick="return eventURL(\'action:toggleDownloadsView\');">\n  ')
  30.             if not showDownloads:
  31.                 out.write(u'<div class="triangle"></div>')
  32.             
  33.             out.write(u'\n  ')
  34.             if not not showDownloads:
  35.                 out.write(u'<div class="triangle down"></div>')
  36.             
  37.             out.write(u'\n  <a href="#" class="download-bar-action" onclick="eventURLAndStop(\'action:cancelDownloads\', event);">Cancel All</a>\n  ')
  38.             if not allItemsPaused(allDownloadingItems):
  39.                 out.write(u'<a href="#" class="download-bar-action" onclick="eventURLAndStop(\'action:pauseDownloads\', event);">Pause All</a>')
  40.             
  41.             out.write(u'\n  ')
  42.             if not allItemsDownloading(allDownloadingItems):
  43.                 out.write(u'<a href="#" class="download-bar-action" onclick="eventURLAndStop(\'action:resumeDownloads\', event);">Resume All</a>')
  44.             
  45.             out.write(u'\n  ')
  46.             if not allDownloadingItems.len() == 1:
  47.                 out.write(u'<span>\n      <span>')
  48.                 out.write(escape(allDownloadingItems.len()))
  49.                 out.write(u'</span> Downloading</span>')
  50.             
  51.             out.write(u'\n   ')
  52.             if not allDownloadingItems.len() != 1:
  53.                 out.write(u'<span>1 Downloading</span>')
  54.             
  55.             out.write(u'\n</div>\n</div>')
  56.         
  57.         out.write(u'\n</div>')
  58.         out.seek(0)
  59.         return out
  60.  
  61.     handle.addUpdate('tmplcomp64690763', 'nextSibling', allDownloadingItems, up_0_handle, u'allDownloadingItems')
  62.     
  63.     def up_1_handle(viewName, view, tid):
  64.         out = StringIO()
  65.         out.write(u'<div class="downloading-sort" id="')
  66.         out.write(quoteattr(tid))
  67.         out.write(u'">\n        ')
  68.         if not downloadingItems.len() == 0:
  69.             out.write(u'<div>\n            ')
  70.             out.write(fillStaticTemplate(u'sort-bar', onlyBody = True, section = 'downloading', itemSort = itemSortDownloading))
  71.             out.write(u'\n        </div>')
  72.         
  73.         out.write(u'\n    </div>')
  74.         out.seek(0)
  75.         return out
  76.  
  77.     handle.addUpdate('tmplcomp04071604', 'nextSibling', downloadingItems, up_1_handle, u'downloadingItems')
  78.     
  79.     def up_2_handle(viewName, view, tid):
  80.         out = StringIO()
  81.         out.write(u'<a href="#" class="main-channelbar available-channelbar" onclick="return eventURL(\'action:toggleNewItemsView\');" id="')
  82.         out.write(quoteattr(tid))
  83.         out.write(u'">\n        ')
  84.         if not showNewItems:
  85.             out.write(u'<div class="triangle"></div>')
  86.         
  87.         out.write(u'\n        ')
  88.         if not not showNewItems:
  89.             out.write(u'<div class="triangle down"></div>')
  90.         
  91.         out.write(u'\n\n        ')
  92.         if not not (not isFolder):
  93.             out.write(u'<div>\n            ')
  94.             if not feed.inlineSearchTerm is not None:
  95.                 out.write(u'<div>\n                <span>')
  96.                 out.write(escape(notDeleted.len()))
  97.                 out.write(u'</span> \n                Items in this Channel\n            </div>')
  98.             
  99.             out.write(u'\n            ')
  100.             if not feed.inlineSearchTerm is None:
  101.                 out.write(u'<div>\n                ')
  102.                 if not not (notDeleted.len() == matchingItems.len()):
  103.                     out.write(u'<div>\n                    All <span>')
  104.                     out.write(escape(matchingItems.len()))
  105.                     out.write(u'</span> \n                    Match This Search\n                </div>')
  106.                 
  107.                 out.write(u'\n                ')
  108.                 if not notDeleted.len() == matchingItems.len():
  109.                     out.write(u'<div>\n                    <span>')
  110.                     out.write(escape(matchingItems.len()))
  111.                     out.write(u'</span> \n                    Match This Search\n                </div>')
  112.                 
  113.                 out.write(u'\n            </div>')
  114.             
  115.             out.write(u'\n        </div>')
  116.         
  117.         out.write(u'\n\n        ')
  118.         if not not isFolder:
  119.             out.write(u'<div>\n            <span>')
  120.             out.write(escape(notDeleted.len()))
  121.             out.write(u'</span> \n            Items in this Channel Folder\n        </div>')
  122.         
  123.         out.write(u'\n    </a>')
  124.         out.seek(0)
  125.         return out
  126.  
  127.     handle.addUpdate('tmplcomp74963951', 'nextSibling', matchingItems, up_2_handle, u'matchingItems')
  128.     
  129.     def up_3_handle(viewName, view, tid):
  130.         out = StringIO()
  131.         out.write(u'<div id="')
  132.         out.write(quoteattr(tid))
  133.         out.write(u'">\n    ')
  134.         if not not showNewItems:
  135.             out.write(u'<div class="available-sort">\n        ')
  136.             out.write(fillStaticTemplate(u'sort-bar', onlyBody = True, section = 'main', itemSort = itemSort))
  137.             out.write(u'\n    </div>')
  138.         
  139.         out.write(u'\n</div>')
  140.         out.seek(0)
  141.         return out
  142.  
  143.     handle.addUpdate('tmplcomp99380725', 'nextSibling', matchingItems, up_3_handle, u'matchingItems')
  144.     
  145.     def up_4_handle(viewName, view, tid):
  146.         out = StringIO()
  147.         out.write(u'<div id="')
  148.         out.write(quoteattr(tid))
  149.         out.write(u'">  \n  ')
  150.         if not allItemsMode and not showNewItems or newItems.len() == matchingItems.len():
  151.             out.write(u'<div>\n      <a href="#" class="main-notification" onclick="return eventURL(\'action:toggleAllItemsMode\');">\n          ')
  152.             if not isFolder:
  153.                 out.write(u'<span><span>')
  154.                 out.write(escape(matchingItems.len() - newItems.len()))
  155.                 out.write(u'</span> more on this channel >></span>')
  156.             
  157.             out.write(u'\n          ')
  158.             if not not isFolder:
  159.                 out.write(u'<span><span>')
  160.                 out.write(escape(matchingItems.len()))
  161.                 out.write(u'</span> items in this channel folder >></span>')
  162.             
  163.             out.write(u'\n        </a>\n        <a href="#" class="main-notification-right" onclick="return eventURL(\'action:toggleAllItemsMode\');"> </a>\n     <br clear="left"></br>\n  </div>')
  164.         
  165.         out.write(u'\n</div>')
  166.         out.seek(0)
  167.         return out
  168.  
  169.     handle.addUpdate('tmplcomp26255401', 'nextSibling', matchingItems, up_4_handle, u'matchingItems')
  170.     
  171.     def up_5_handle(viewName, view, tid):
  172.         out = StringIO()
  173.         out.write(u'<div id="')
  174.         out.write(quoteattr(tid))
  175.         out.write(u'">\n        ')
  176.         if not len(allWatchableItems) == 0 and not isFolder and feed.getURL().startswith('dtv:directoryfeed'):
  177.             out.write(u'<a href="#" class="main-channelbar downloaded-channelbar" onclick="return eventURL(\'action:toggleWatchableView\')">\n            ')
  178.             if not showWatchableItems:
  179.                 out.write(u'<div class="triangle"></div>')
  180.             
  181.             out.write(u'\n            ')
  182.             if not not showWatchableItems:
  183.                 out.write(u'<div class="triangle down"></div>')
  184.             
  185.             out.write(u'\n            <span>')
  186.             tmplcomp33474113 = { }
  187.             tmplcomp98438263 = StringIO()
  188.             tmplcomp98438263.write(u'<span>')
  189.             tmplcomp98438263.write(escape(allWatchableItems.len()))
  190.             tmplcomp98438263.write(u'</span>')
  191.             tmplcomp98438263.seek(0)
  192.             tmplcomp33474113['len'] = tmplcomp98438263.read()
  193.             out.write(Template(_(u'${len} Downloaded')).substitute(tmplcomp33474113))
  194.             out.write(u'</span>\n        </a>')
  195.         
  196.         out.write(u'\n    </div>')
  197.         out.seek(0)
  198.         return out
  199.  
  200.     handle.addUpdate('tmplcomp15052749', 'nextSibling', allWatchableItems, up_5_handle, u'allWatchableItems')
  201.     
  202.     def up_6_handle(viewName, view, tid):
  203.         out = StringIO()
  204.         out.write(u'<div id="')
  205.         out.write(quoteattr(tid))
  206.         out.write(u'">\n        ')
  207.         if not len(watchableItems) == 0:
  208.             out.write(u'<div>\n            ')
  209.             out.write(fillStaticTemplate(u'sort-bar', onlyBody = True, section = 'watchable', itemSort = itemSortWatchable))
  210.             out.write(u'\n        </div>')
  211.         
  212.         out.write(u'\n    </div>')
  213.         out.seek(0)
  214.         return out
  215.  
  216.     handle.addUpdate('tmplcomp69879437', 'nextSibling', watchableItems, up_6_handle, u'watchableItems')
  217.     
  218.     def rep_7_handle(this, viewName, view, tid):
  219.         out = StringIO()
  220.         out.write(u'\n<div dragsourcetype="')
  221.         out.write(quoteattr(this.getDragType()))
  222.         out.write(u'" selectArea="itemlist" drageffectdownloadeditem="move" dragdestdata="playlistitem-')
  223.         out.write(quoteattr(this.getID()))
  224.         out.write(u'" dragicon="video-tnail-')
  225.         out.write(quoteattr(viewName + str(this.getID())))
  226.         out.write(u'" selectID="')
  227.         out.write(quoteattr(this.getID()))
  228.         out.write(u'" class="main-video draggable ')
  229.         out.write(quoteattr(this.getSelectedState(view)))
  230.         out.write(u' ')
  231.         out.write(quoteattr(this.getMoreInfoState()))
  232.         out.write(u'" dragsourcedata="itemlist-')
  233.         out.write(quoteattr(this.getID()))
  234.         out.write(u'" onclick="return handleSelect(event);" selectViewName="')
  235.         out.write(quoteattr(urlencode(viewName)))
  236.         out.write(u'" onmousedown="return handleContextMenuSelect(event);" dragdesttype="')
  237.         if not viewName == 'playlistView' or 'downloadeditem':
  238.             pass
  239.         out.write(quoteattr(''))
  240.         out.write(u'" ondblclick="return handleDblClick(event, \'')
  241.         out.write(quoteattr(urlencode(viewName)))
  242.         out.write(u"', ")
  243.         out.write(quoteattr(urlencode(this.getID())))
  244.         out.write(u');" id="')
  245.         out.write(quoteattr(tid))
  246.         out.write(u'">\n    <div>')
  247.         out.write(this.getItemXML(viewName))
  248.         out.write(u'</div>\n</div>\n')
  249.         out.seek(0)
  250.         return out
  251.  
  252.     handle.addView('tmplcomp27331647', 'containerDiv', downloadingItems, rep_7_handle, u'downloadingItems')
  253.     
  254.     def rep_8_handle(this, viewName, view, tid):
  255.         out = StringIO()
  256.         out.write(u'\n<div dragsourcetype="')
  257.         out.write(quoteattr(this.getDragType()))
  258.         out.write(u'" selectArea="itemlist" drageffectdownloadeditem="move" dragdestdata="playlistitem-')
  259.         out.write(quoteattr(this.getID()))
  260.         out.write(u'" dragicon="video-tnail-')
  261.         out.write(quoteattr(viewName + str(this.getID())))
  262.         out.write(u'" selectID="')
  263.         out.write(quoteattr(this.getID()))
  264.         out.write(u'" class="main-video draggable ')
  265.         out.write(quoteattr(this.getSelectedState(view)))
  266.         out.write(u' ')
  267.         out.write(quoteattr(this.getMoreInfoState()))
  268.         out.write(u'" dragsourcedata="itemlist-')
  269.         out.write(quoteattr(this.getID()))
  270.         out.write(u'" onclick="return handleSelect(event);" selectViewName="')
  271.         out.write(quoteattr(urlencode(viewName)))
  272.         out.write(u'" onmousedown="return handleContextMenuSelect(event);" dragdesttype="')
  273.         if not viewName == 'playlistView' or 'downloadeditem':
  274.             pass
  275.         out.write(quoteattr(''))
  276.         out.write(u'" ondblclick="return handleDblClick(event, \'')
  277.         out.write(quoteattr(urlencode(viewName)))
  278.         out.write(u"', ")
  279.         out.write(quoteattr(urlencode(this.getID())))
  280.         out.write(u');" id="')
  281.         out.write(quoteattr(tid))
  282.         out.write(u'">\n    <div>')
  283.         out.write(this.getItemXML(viewName))
  284.         out.write(u'</div>\n</div>\n')
  285.         out.seek(0)
  286.         return out
  287.  
  288.     handle.addView('tmplcomp47454463', 'containerDiv', newItems, rep_8_handle, u'newItems')
  289.     
  290.     def rep_9_handle(this, viewName, view, tid):
  291.         out = StringIO()
  292.         out.write(u'\n<div dragsourcetype="')
  293.         out.write(quoteattr(this.getDragType()))
  294.         out.write(u'" selectArea="itemlist" drageffectdownloadeditem="move" dragdestdata="playlistitem-')
  295.         out.write(quoteattr(this.getID()))
  296.         out.write(u'" dragicon="video-tnail-')
  297.         out.write(quoteattr(viewName + str(this.getID())))
  298.         out.write(u'" selectID="')
  299.         out.write(quoteattr(this.getID()))
  300.         out.write(u'" class="main-video draggable ')
  301.         out.write(quoteattr(this.getSelectedState(view)))
  302.         out.write(u' ')
  303.         out.write(quoteattr(this.getMoreInfoState()))
  304.         out.write(u'" dragsourcedata="itemlist-')
  305.         out.write(quoteattr(this.getID()))
  306.         out.write(u'" onclick="return handleSelect(event);" selectViewName="')
  307.         out.write(quoteattr(urlencode(viewName)))
  308.         out.write(u'" onmousedown="return handleContextMenuSelect(event);" dragdesttype="')
  309.         if not viewName == 'playlistView' or 'downloadeditem':
  310.             pass
  311.         out.write(quoteattr(''))
  312.         out.write(u'" ondblclick="return handleDblClick(event, \'')
  313.         out.write(quoteattr(urlencode(viewName)))
  314.         out.write(u"', ")
  315.         out.write(quoteattr(urlencode(this.getID())))
  316.         out.write(u');" id="')
  317.         out.write(quoteattr(tid))
  318.         out.write(u'">\n    <div>')
  319.         out.write(this.getItemXML(viewName))
  320.         out.write(u'</div>\n</div>\n')
  321.         out.seek(0)
  322.         return out
  323.  
  324.     handle.addView('tmplcomp05686637', 'containerDiv', watchableItems, rep_9_handle, u'watchableItems')
  325.     localvars = locals()
  326.     localvars.update(globals())
  327.     handle_0 = Handle(domHandler, localvars, onUnlink = (lambda : None))
  328.     handle.addSubHandle(handle_0)
  329.     localvars = locals()
  330.     localvars.update(globals())
  331.     handle_1 = Handle(domHandler, localvars, onUnlink = (lambda : None))
  332.     handle.addSubHandle(handle_1)
  333.     localvars = locals()
  334.     localvars.update(globals())
  335.     handle_2 = Handle(domHandler, localvars, onUnlink = (lambda : None))
  336.     handle.addSubHandle(handle_2)
  337.     out = StringIO()
  338.     out.write(u'<?xml version="1.0" encoding="utf-8"?>\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n')
  339.     out.write(u'<html dtvPlatform="')
  340.     out.write(quoteattr(urlencode(dtvPlatform)))
  341.     out.write(u'" eventCookie="')
  342.     out.write(quoteattr(urlencode(eventCookie)))
  343.     out.write(u'" xmlns:t="http://www.participatorypolitics.org/" xmlns="http://www.w3.org/1999/xhtml" xmlns:i18n="http://www.participatoryculture.org/i18n">\n<head>\n    <meta content="text/html; charset=utf-8" http-equiv="content-type"></meta>\n        <script type="text/javascript">\n<!-- // Protect from our XML parser, which doesn\'t know to protect <script>\n\n///////////////////////////////////////////////////////////////////////////////\n//// For use on your page                                                  ////\n///////////////////////////////////////////////////////////////////////////////\n\nfunction getDTVPlatform() {\n    var elt = document.getElementsByTagName("html")[0];\n    return elt.getAttribute(\'dtvPlatform\');\n}\n\nfunction loadURL(url) {\n    try {\n        document.location.href = url;\n    } catch (e) {\n        // This may happen if the backend decides to handle the url load\n        // itself.\n    }\n}\n\n// For calling from page Javascript: Cause a URL to be loaded. The\n// assumption is that the application will notice, abort the load, and\n// take some action based on the URL.\nfunction eventURL(url) {\n    if (typeof(window.frontend) == \'undefined\') {\n\t// Generic strategy: trigger a load, and hope the application\n\t// catches it and cancels it without creating a race\n\t// condition.\n        loadURL(url)\n    } else {\n\t// OS X WebKit (KHTML) strategy: pass in an Objective C object\n\t// through the window object and call a method on it.\n\twindow.frontend.eventURL(url);\n    }\n\n    return false;\n}\n\n// Calls eventURL, then calls event.stopPropagation() and\n// event.preventDefault() so that the event chain is stopped.\nfunction eventURLAndStop(url, event) {\n  eventURL(url);\n  event.stopPropagation();\n  event.preventDefault();\n}\n\nfunction recommendItem(title, url) {\n    loadURL(\'http://www.videobomb.com/index/democracyemail?url=\' + \n            url + \'&title=\' + title);\n    return false;\n}\n\nfunction recommendChannel(title, url) {\n    // See also app.py if changing this URL\n    loadURL(\'http://www.videobomb.com/democracy_channel/email_friend\' +\n        \'?url=\' + url + \'&title=\' + title);\n    return false;\n}\n\n// Start the video player. The playlist will be the items in the view\n// named by viewName. If firstItemId is the id of an item in the view,\n// playback will start on that item; otherwise playback will start on\n// the first item.\nfunction playViewNamed(viewName, firstItemId) {\n    url = \'action:playViewNamed?\';\n    url = url + \'viewName=\' + URLencode(viewName);\n    url = url + \'&firstItemId=\' + URLencode(firstItemId);\n    eventURL(url);\n    return false;\n}\n\n// You can make \'incremental search\' text boxes on your page that\n// effectively tie the text box to the \'parameter\' argument of setViewFilter,\n// with the other argumens fixed. To do this, add these two attributes to\n// the text box:\n//   onfocus="startEditSearch(this)"\n//   onblur="endEditFilter()"\n// replacing the arguments in parentheses with the desired strings.\n//\n// You\'ll also need to provide a updateSearchString function at the\n// top of your template to perform the actual update\n\nvar editSearchField = null;\nvar editSearchOldValue = \'\';\nvar editSearchTimer = null;\nvar editSearchCallback = null;\n\nfunction onSearchFocus(obj){\n  if (obj.getAttribute(\'searching\') != \'1\') {\n\tobj.value="";\n\tobj.searching = \'1\';\n  }\n  startEditSearch(obj, null);\n}\n\nfunction startEditSearch(obj, callback) {\n  editSearchOldValue = obj.value;\n\n  editSearchField = obj;\n  editSearchCallback = callback;\n  editSearchTimerTick();\n}\n\nfunction editSearchUpdate() {\n    value = editSearchField.value;\n    if (editSearchOldValue != value) {\n\turl = \'action:setSearchString?searchString=\' + URLencode(value);\n\teventURL(url);\n\teditSearchOldValue = value;\n\tif(editSearchCallback) editSearchCallback();\n    }\n}\n\nfunction editSearchTimerTick() {\n    editSearchUpdate();\n    editSearchTimer = setTimeout(editSearchTimerTick, 50);\n}\n\nfunction endEditSearch() {\n  clearTimeout(editSearchTimer);\n  editSearchUpdate();\n}\n\n// Internal use: \'URL encode\' the given string.\nfunction URLencode(str) {\n    return encodeURIComponent(str)\n}\n\nfunction URLdecode(str) {\n  return decodeURIComponent(str)\n}\n\nvar currentSelectBoxMenu = null;\nfunction showSelectBoxMenu(id) {\n    document.getElementById(id).style.display = \'block\';\n    currentSelectBoxMenu = id;\n    document.addEventListener(\'click\', hideSelectBoxMenu, true)\n}\n\nfunction hideSelectBoxMenu(event) {\n    document.getElementById(currentSelectBoxMenu).style.display = \'\';\n    currentSelectBoxMenu = null;\n    document.removeEventListener(\'click\', hideSelectBoxMenu, true)\n}\n\n///////////////////////////////////////////////////////////////////////////////\n//// For calling by host templating code                                   ////\n///////////////////////////////////////////////////////////////////////////////\n\n// For calling by host templating code: Set CSS styles on the item\n// with the given ID to make it disappear.\nfunction hideItem(id) {\n    elt = document.getElementById(id);\n    elt.style.display = \'none\';\n    forceRedisplay(elt);\n}\n\n// For calling by host templating code: Set CSS styles on the item\n// with the given ID to make it visible if it was previously hidden.\nfunction showItem(id) {\n    elt = document.getElementById(id);\n    elt.style.display = \'\';\n    forceRedisplay(elt);\n}\n\n// For calling by host templating code: Replace the item with the\n// given id with the element described by the proided XML.\nfunction changeItem(id, newXML) {\n    elt = document.getElementById(id);\n    r = document.createRange();\n    r.selectNode(elt);\n    frag = r.createContextualFragment(newXML);\n    elt.parentNode.replaceChild(frag, elt);\n}\n\n// For calling by host templating code: Parse the XML in newXML into a\n// new element, and insert the new element immediately before the item\n// with the given id, such that the newly inserted item has the same\n// parent.\nfunction addItemBefore(newXML, id) {\n    elt = document.getElementById(id);\n    r = document.createRange();\n    r.selectNode(elt);\n    frag = r.createContextualFragment(newXML);\n    elt.parentNode.insertBefore(frag, elt);\n}    \n\n// For calling by host templating code: Parse the XML in newXML into a\n// new element, and insert the new element as the final child of the\n// item with the given id.\nfunction addItemAtEnd(newXML, id) {\n    elt = document.getElementById(id);\n    r = document.createRange();\n    r.selectNode(elt);\n    frag = r.createContextualFragment(newXML);\n    elt.insertBefore(frag, null);\n}    \n\n// For calling by host templating code: Remove the item with the given\n// id.\nfunction removeItem(id) {\n    elt = document.getElementById(id);\n    elt.parentNode.removeChild(elt);\n}    \n\n// Internal use: Sometime if all you do is change the style on a node,\n// Safari doesn\'t update the view until your mouse is next over the\n// window. Force the issue by making a drastic change in the vicinity\n// of the given element and then reversing it.\nfunction forceRedisplay(elt) {\n    r = document.createRange();\n    r.selectNode(elt);\n    frag = r.extractContents();\n    r.insertNode(frag);\n}\n\nfunction handleContextMenuSelect(event) {\n  if(event.button == 2) {\n    var area = event.currentTarget.getAttribute("selectArea");\n    var id = event.currentTarget.getAttribute("selectID");\n    var viewName = event.currentTarget.getAttribute("selectViewName");\n    var url = \'action:handleContextMenuSelect?id=\' + id + \'&area=\' + area +\n              \'&viewName=\' + viewName;\n    eventURL(url);\n  }\n  return true;\n}\n\nfunction handleSelect(event) {\n   if(event.target.tagName && event.target.tagName.toUpperCase() == \'A\') {\n       // Either a link in the descrption, or a bomb/mailto/trash click\n       return true;\n    }\n    var id = event.currentTarget.getAttribute("selectID");\n    var viewName = event.currentTarget.getAttribute("selectViewName");\n    var area = event.currentTarget.getAttribute("selectArea");\n    var shiftKey = \'0\';\n    var ctrlKey = \'0\';\n    if(event.shiftKey) shiftKey = \'1\';\n    if(event.ctrlKey || event.metaKey) ctrlKey = \'1\';\n    eventURL(\'action:handleSelect?area=\' + area + \'&viewName=\' + viewName + \n\t\'&id=\' + id + \'&shiftDown=\' + shiftKey + \'&ctrlDown=\' + ctrlKey);\n    return true;\n}\n\nfunction handleDblClick(event, viewName, id) {\n   var target = event.target;\n   while (target != undefined && target.ondblclick === null && target.tagName.toUpperCase() != \'A\') {\n       target = target.parentNode;\n   }\n\n   if(target.tagName.toUpperCase() == \'A\') {\n       // Either a link in the descrption, or a bomb/mailto/trash click\n       return true;\n   } else {\n       return eventURL(\'action:playViewNamed?viewName=\' + viewName + \n           \'&firstItemId=\' + id);\n   }\n}\n\nfunction getKeyFromEvent(evt) {\n  var key = 0;\n  if (window.event)  {\n    key = evt.keyCode;\n  } else if (evt.which) {\n  \tkey = evt.which;\n  }\n\n  return key;\n}\n\nfunction sendKeyToSearchBox(event) {\n  if(event.altKey || event.ctrlKey || event.metaKey ||\n      (event.target.tagName && event.target.tagName.toUpperCase() == \'INPUT\'))\n      return true;\n  var key = getKeyFromEvent(event);\n  if ((key == 33) || (key == 34) || (key == 35) || (key == 36) || \n      (key == 37) || (key == 38) || (key == 39) || (key == 40))\n      return true;\n  var searchBox = document.getElementById("search-box");\n  searchBox.focus();\n  return true;\n}\n\nfunction playNewVideos(event, id) {\n  eventURL(\'action:playNewVideos?id=\' + id);\n  event.stopPropagation(); // don\'t want handleSelect to deal with this event\n  return false;\n}\n\n///////////////////////////////////////////////////////////////////////////////\n///////////////////////////////////////////////////////////////////////////////\n\n-->\n</script>\n\n\n</head>\n<body')
  344.     out.write(u' ' + bodyTagExtra)
  345.     out.write(u'>\n\n')
  346.     out.write(u'<span id="tmplcomp64690763"/>\n\n    ')
  347.     out.write(u'<span id="tmplcomp04071604"/>\n    <div id="tmplcomp27331647">')
  348.     out.write(u'</div>\n\n\n\n\n\n<div class="available-channelbar-wrap">\n    ')
  349.     out.write(u'<span id="tmplcomp74963951"/>\n</div>\n\n')
  350.     out.write(u'<span id="tmplcomp99380725"/>\n\n<div id="tmplcomp47454463">')
  351.     out.write(u'</div>\n\n\n')
  352.     out.write(u'<span id="tmplcomp26255401"/>\n\n\n\n\n<div id="tmplcomp58438289"')
  353.     
  354.     _hideFunc = lambda : if not isFolder:
  355. passfeed.getURL().startswith('dtv:directoryfeed')
  356.     _dynHide = _hideFunc()
  357.     if _dynHide:
  358.         out.write(u' style="display:none">')
  359.     else:
  360.         out.write(u'>')
  361.     handle.addUpdateHideOnView('tmplcomp58438289', thisFeedView, _hideFunc, _dynHide)
  362.     out.write(u'\n    ')
  363.     out.write(u'<span id="tmplcomp15052749"/>\n    \n    ')
  364.     out.write(u'<span id="tmplcomp69879437"/>\n    <div id="tmplcomp05686637">')
  365.     out.write(u'</div>\n</div>\n\n\n</><!-- HOT SPOT END -->\n</html>')
  366.     out.seek(0)
  367.     return (out, handle)
  368.  
  369.